#!/usr/bin/env python3
# coding:utf-8
import subprocess

ifc="eth1"
p = subprocess.Popen(
    ["ip link show %s|grep link|awk '{print $2}'"%(ifc)],
    shell=True,
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT,
)
p.wait()
buf = p.stdout.read()
print("执行过程输出: ", buf.decode("utf-8"))
print("执行结果: ", p.returncode)
